/**
 * @author Pieter Michels / wellconsidered
 * pieter@wellconsidered.be
 *
 * Open source under the GNU Lesser General Public License (http://www.opensource.org/licenses/lgpl-license.php)
 * Copyright © 2009 Pieter Michels / wellconsidered
 * 
 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License 
 * as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License along with this library; 
 * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 */
 
package be.wellconsidered.apis.lighthouse
{
	import flash.events.EventDispatcher;
	
	import mx.utils.Base64Encoder;
	
	public class LightHouse extends EventDispatcher
	{
		private var _sURL:String = "";
		private var _sToken:String = "";
		
		private var _sUsername:String = "";
		private var _sPassword:String = "";
		
		private var _be64Encoder:Base64Encoder;
		
		public function LightHouse(url:String, token:String, username:String, password:String)
		{
			_sURL = url;
			_sToken = token;
			_sUsername = username;
			_sPassword = password;
			
			setAuthEncoder();
		}
		
		private function setAuthEncoder():void
		{
			_be64Encoder = new Base64Encoder();
			
			_be64Encoder.encode(_sUsername + ":" + _sPassword);
		}
		
		/**
		 * Get Base64Encoding of password and username;
		 */
		public function getBase64Encoding():Base64Encoder
		{
			return _be64Encoder;
		}
		
		public function getToken():String
		{
			return _sToken;
		}
		
		public function getURL():String
		{
			return _sURL;
		}
	}
}